package cn.etg.observer_java;

import java.util.Observable;
import java.util.Observer;

public class ObserverOne implements Observer {

    public void registerSubject(Observable observable){
        observable.addObserver(this);
    }
    @Override
    public void update(Observable o, Object arg) {
        if(o instanceof SubjectFor3d){
            SubjectFor3d subject = (SubjectFor3d) o;
            System.out.println("3D服务消息==>"+subject.getMsg()+arg);
        }
        if(o instanceof SubjectForSSQ){
            SubjectForSSQ subject = (SubjectForSSQ) o;
            System.out.println("双色球服务消息==》"+subject.getMsg()+arg);
        }
    }
}
